import 'dart:convert';

import 'starter/platform/platform_processor.dart';

extension stringRes on ChannelApi {
  Future<dynamic> obtainStrResource(List<String> list) {
    return call("UtilApi/obtainI18nResources", json.encode(list));
  }
}

extension Web on ChannelApi {
  Future? openWeb(String url) async {
    await call("NavigationApi/openWeb", url);
  }

  Future<void> openHTML(String content) async {
    await call("NavigationnApi/openHTML", content);
  }
}

extension Login on ChannelApi {
  Future<dynamic> loginByWeChat() async {
    return await call("ThirdPartLogin/loginByWwChat", null);
  }

  Future<dynamic> loginByFacebook() async {
    return await call("ThirdPartLogin/loginByFacebook", null);
  }

  Future<dynamic> loginByApple() async {
    return await call("ThirdPartLogin/loginByApple", null);
  }
}

extension ArticleDetail on ChannelApi {
  Future<dynamic> openVideoDetail(dynamic json) async {
    return await call("VideoDetailApi/openDetail", jsonEncode(json));
  }
}

extension ThirdSDKAPI on ChannelApi {
  Future<dynamic> openTransform() async {
    return await call("NavigationAPI/openTransform", null);
  }

  Future<dynamic> initSDK() async {
    return await call("NavigationAPI/initNative", null);
  }

  Future<dynamic> getAndroidId() async {
    return await call("NavigationAPI/getAndroidId", null);
  }

  Future<dynamic> openAR() async {
    return await call("NavigationAPI/openAR", null);
  }

  Future<dynamic> getRegistrationID() async {
    return await call("NavigationAPI/getRegistrationID", null);
  }

  Future<dynamic> apkVerifyWithSHA() async {
    return await call("NavigationAPI/apkVerifyWithSHA", null);
  }
  // "NavigationAPI/apkVerifyWithSHA
}

// extension RegTokenAPI on ChannelApi {
//   Future<dynamic> getRegToken() async {
//     return await call("NavigationAPI/getTokenAPI", null);
//   }
// }
